package com.leo.customer.controller

import com.leo.customer.entity.pojo.Post
import com.leo.customer.service.PostService
import io.swagger.annotations.Api
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import java.time.LocalDateTime

@Api(tags = ["职位操作管理"])
@RestController
@RequestMapping("post")
class PostController {

    @Autowired
    lateinit var postService: PostService

    @PostMapping("create")
    fun createPost(@RequestBody post:Post): Post {
        return postService.createPost(post)
    }

    @GetMapping("edit")
    fun editPost(@RequestParam postId:Int) {
        val post = postService.findPostById(postId)
        post.endTime = LocalDateTime.now()
        postService.createPost(post)
    }
}
